package com.game.modular.gameCore.drawCards.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import com.fasterxml.jackson.annotation.JsonFormat;

/**
 * 抽卡配置(按类型-稀有度)(CoreDrawConfig)表实体类
 *
 * @author cxy
 * @since 2024-08-08 16:38:26
 */
@ApiModel("抽卡配置(按类型-稀有度)")
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@EqualsAndHashCode(callSuper = true)
@SuppressWarnings("serial")
public class CoreDrawConfig extends Model<CoreDrawConfig> {// swagger2,mybatis-plus
    ///////////////////////////////////////////////////////////////////////////////////////////////////////// 生成实体字段
    @TableId(type = IdType.AUTO)
    @ApiModelProperty("抽卡类型")
    private Long type;
    
    @ApiModelProperty("配置名称")
    private String name;
    
    @ApiModelProperty("稀有度对应的保底")
    private String time;
    
    @ApiModelProperty("单抽价格")
    private String onePrice;
    
    @ApiModelProperty("十连价格")
    private String tenPrice;
    
    ///////////////////////////////////////////////////////////////////////////////////////////////////////// 序列化版本号
    @TableField(exist = false)
    private static final long serialVersionUID = 906275336477164229L;
    /////////////////////////////////////////////////////////////////////////////////////////////////////////// 获取主键值
    @Override
    public Serializable pkVal() {
        return this.type;
    }
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////
    public String[] getPrice(Integer num){
        if (num == 1){
            if (onePrice.contains(",")){
                return onePrice.split(",");
            }
            return new String[]{onePrice};
        }if (num == 10){
            if (tenPrice.contains(",")){
                return tenPrice.split(",");
            }
            return new String[]{tenPrice};
        }
        return null;
    }

    public String[] getTimes(){
        if (this.time.contains(",")){
            return time.split(",");
        }
        return new String[]{time};
    }
}

